<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table cellspacing="0" border="0" width="995">
	<tr>
		<td width="995" class="title_manager_product">Quản lý tin tức</td>
	</tr>
	<tr>
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="995">
				<tr>
					<td align="center">
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td align="center"><img src="images/CreateNews.gif" width="48" height="47" border="0" /></td>
							</tr>
							<tr>
								<td align="center" class="title_new_add"><a href="index.php?admin=newAdmin&do=formaddnews">Thêm tin tức</a></td>
							</tr>
						</table>
						
					</td>
					
					<td align="center">
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td align="center"><img src="images/CreateCategory.gif" width="51" height="48" border="0" /></td>
							</tr>
							<tr>
								<td align="center" class="title_new_add"><a href="index.php?admin=newAdmin&do=formaddnewtype">Thêm kiểu tin tức</a></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>	
	</tr>
</table>

<table cellspacing="0" border="0" width="995">
	<tr>
		<td width="200" valign="top">					
			<?php
				include("menuleftnew.php");
			?>
		</td>	
		<td width="795" valign="top">
			<?php
				$id=$_GET['id'];
			?>
			<form action="index.php?admin=newAdmin&do=formeditnewcategory&id=<?php echo $id;?>" method="post" enctype="multipart/form-data">
			<table cellspacing="0" border="0" width="790">
				<tr>
					<td width="790" class="title_manager_cate">Sửa danh mục tin</td>
				</tr>
			</table>
			<table class="reference" cellspacing="0" border="1" width="100%">
			<tr>
				<td></td>
				<td>
					<?php
						$id=$_GET['id'];	
						$titleNew = $_POST['titleNew'];
						$description = $_POST['description'];
						if(isset($_POST['submit'])){
							if(empty($titleNew)){
								echo"<font color=\"red\">Bạn phải nhập vào tên danh mục tin.</font>"; 
							}else{
								$query="UPDATE news SET titleNew='$titleNew',description='$description' WHERE id=$id";
								mysql_query($query);
								echo "Nhóm danh mục download đã được sửa thành công.";
								echo "<script>window.location='index.php?admin=newAdmin&do=listnew'</script>";		
							}
						}
					?>
				</td>
			</tr>
			<?php
				$query="SELECT * FROM news WHERE id=$id";
				$result=mysql_query($query);
				while($row=mysql_fetch_array($result)){?>
					<tr>
						<td width="200"><b>Tên danh mục tin:</b></td>
						<td>
							<input type="text" name="titleNew" size="40" value="<?php echo $row['titleNew']?>" />
						</td>
					</tr>
					<tr>
						<td width="200"><b>Mô tả:</b></td>
						<td>
							<textarea name="description"><?php echo $row['description']?></textarea>
						</td>
					</tr>
			<?php
			}
			?>   	      	 
				   <tr>
						<td></td>
						<td>
							<input type="submit" name="submit" value="Sửa danh mục" />
							<input type="button" name="Cancel" value="Cancel" onclick="window.location = 'index.php?admin=newAdmin&do=listnew' " /> 
						<td>
				   </tr>
				</table>
			</form>
		</td>
	</tr>	
</table>
</body>
</html>